<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" xmlns:o="http://omnifaces.org/ui"
	xmlns:of="http://omnifaces.org/functions"
	xmlns:pe="http://primefaces.org/ui/extensions"
	template="/templates/main_free_template.xhtml">

	<ui:define name="header">
		<script type="text/javascript">
			//<![CDATA[
			//debe usarse los \\:  en lugar de : en los selectores de JQuery
			$(document).ready(function() {
				$("#form_login\\:username").val('asohofrucol');
				$("#form_login\\:password").val('123abcD');
				//$("#form_login\\:loginButton").click();				
			});
			function processLogin(xhr, status, args) {
				if (!args.validationFailed && args.logIn) {
					setTimeout(function() {
						window.location = args.view;
					}, 500);
				}
			}
			//]]>
		</script>
	</ui:define>

	<ui:define name="content">
		<p:growl id="mensajes" showDetail="true" life="2000" />
		<h1>
			<h:outputLabel value="#{i18n['lbl.login.title']}" />
		</h1>
		<h:form id="form_login">
			<div class="clearfix common-panel text-align-center">

				<div class="clearfix width-400px" style="margin-left: 405px;">
					<div class="ui-form-row clearfix text-align-left">
						<h:outputLabel for="username"
							value="#{i18n['lbl.login.user_name']}" />
					</div>
					<div class="ui-form-row clearfix text-align-left">
						<p:inputText value="#{loginController.userName}" id="username"
							required="true" label="username" />
					</div>

					<div class="ui-form-row clearfix text-align-left">
						<h:outputLabel for="password"
							value="#{i18n['lbl.login.password']}" />
					</div>
					<div class="ui-form-row clearfix text-align-left">
						<p:password value="#{loginController.password}" id="password"
							required="true" label="password" />
					</div>
				</div>
				<div class="ui-form-row clearfix text-align-center">
					<p:commandButton id="loginButton"
						value="#{i18n['lbl.login.login']}"
						actionListener="#{loginController.login}" update=":mensajes"
						oncomplete="processLogin(xhr, status, args)" />
				</div>
			</div>



		</h:form>

	</ui:define>
</ui:composition>